package com.example.demo.pojos;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.List;
import java.util.Objects;

@Entity
public class Fixcheck {
    private int fcId;
    private Timestamp fcCheckerDate;
    private String fcGoodsName;
    private Timestamp fcFixGoodsProductDate;
    private Timestamp fcFixGoodsSaleDate;
    private int fcIsRepair;
    private String fcErrDescription;
    private int fcState;
    private int fcCost;
    private int fcMlr;
    private User jcr;
    private Fix wxb;
    private Fixreceive wxjjb;


    @Id
    @Column(name = "fc_ID", nullable = false)
    public int getFcId() {
        return fcId;
    }

    public void setFcId(int fcId) {
        this.fcId = fcId;
    }

    @Basic
    @Column(name = "fc_checkerDate", nullable = false)
    public Timestamp getFcCheckerDate() {
        return fcCheckerDate;
    }

    public void setFcCheckerDate(Timestamp fcCheckerDate) {
        this.fcCheckerDate = fcCheckerDate;
    }

    @Basic
    @Column(name = "fc_goodsName", nullable = false, length = 10)
    public String getFcGoodsName() {
        return fcGoodsName;
    }

    public void setFcGoodsName(String fcGoodsName) {
        this.fcGoodsName = fcGoodsName;
    }

    @Basic
    @Column(name = "fc_fixGoodsProductDate", nullable = false)
    public Timestamp getFcFixGoodsProductDate() {
        return fcFixGoodsProductDate;
    }

    public void setFcFixGoodsProductDate(Timestamp fcFixGoodsProductDate) {
        this.fcFixGoodsProductDate = fcFixGoodsProductDate;
    }

    @Basic
    @Column(name = "fc_fixGoodsSaleDate", nullable = false)
    public Timestamp getFcFixGoodsSaleDate() {
        return fcFixGoodsSaleDate;
    }

    public void setFcFixGoodsSaleDate(Timestamp fcFixGoodsSaleDate) {
        this.fcFixGoodsSaleDate = fcFixGoodsSaleDate;
    }

    @Basic
    @Column(name = "fc_isRepair", nullable = false)
    public int getFcIsRepair() {
        return fcIsRepair;
    }

    public void setFcIsRepair(int fcIsRepair) {
        this.fcIsRepair = fcIsRepair;
    }

    @Basic
    @Column(name = "fc_errDescription", nullable = false, length = 255)
    public String getFcErrDescription() {
        return fcErrDescription;
    }

    public void setFcErrDescription(String fcErrDescription) {
        this.fcErrDescription = fcErrDescription;
    }

    @Basic
    @Column(name = "fc_state", nullable = false)
    public int getFcState() {
        return fcState;
    }

    public void setFcState(int fcState) {
        this.fcState = fcState;
    }

    @Basic
    @Column(name = "fc_cost", nullable = false, precision = 0)
    public int getFcCost() {
        return fcCost;
    }

    public void setFcCost(int fcCost) {
        this.fcCost = fcCost;
    }

    @Basic
    @Column(name = "fc_mlr", nullable = false, precision = 0)
    public int getFcMlr() {
        return fcMlr;
    }

    public void setFcMlr(int fcMlr) {
        this.fcMlr = fcMlr;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Fixcheck fixcheck = (Fixcheck) o;
        return fcId == fixcheck.fcId &&
                fcIsRepair == fixcheck.fcIsRepair &&
                fcState == fixcheck.fcState &&
                fcCost == fixcheck.fcCost &&
                fcMlr == fixcheck.fcMlr &&
                Objects.equals(fcCheckerDate, fixcheck.fcCheckerDate) &&
                Objects.equals(fcGoodsName, fixcheck.fcGoodsName) &&
                Objects.equals(fcFixGoodsProductDate, fixcheck.fcFixGoodsProductDate) &&
                Objects.equals(fcFixGoodsSaleDate, fixcheck.fcFixGoodsSaleDate) &&
                Objects.equals(fcErrDescription, fixcheck.fcErrDescription);
    }

    @Override
    public int hashCode() {
        return Objects.hash(fcId, fcCheckerDate, fcGoodsName, fcFixGoodsProductDate, fcFixGoodsSaleDate, fcIsRepair, fcErrDescription, fcState, fcCost, fcMlr);
    }

    @ManyToOne
    @JoinColumn(name = "fc_checkerID", referencedColumnName = "uid", nullable = false)
    public User getJcr() {
        return jcr;
    }

    public void setJcr(User jcr) {
        this.jcr = jcr;
    }

    @OneToOne(mappedBy = "wxjcb")
    public Fix getWxb() {
        return wxb;
    }

    public void setWxb(Fix wxb) {
        this.wxb = wxb;
    }

    @OneToOne
    @JoinColumn(name = "fc_receiveID", referencedColumnName = "fr_ID", nullable = false)
    public Fixreceive getWxjjb() {
        return wxjjb;
    }

    public void setWxjjb(Fixreceive wxjjb) {
        this.wxjjb = wxjjb;
    }
}
